package main

import "fmt"

// 实现数据类型的判断
func checkType(i interface{}) string {
	switch i.(type) {
	case string:
		return "string"
	case int:
		return "int"
	case float64:
		return "float64"
	default:
		return "unknown"
	}
}

func main() {
	// 验证
	v1 := "hello world"
	v2 := 33
	v3 := 45.2
	fmt.Printf("the type of v1 is %s\n", checkType(v1))
	fmt.Printf("the type of v2 is %s\n", checkType(v2))
	fmt.Printf("the type of v3 is %s\n", checkType(v3))
}
